import {
  getAction,
  deleteAction,
  putAction,
  postAction,
  fromDataPutAction,
  httpAction,
  fromDataPostAction,
  fromDataPostActionMultipart,
} from "@/api/manage";
import { axios as request } from "@/utils/request";
/* ------------------入库模块共有接口 begin------------------ */
export const getAllDictTypes = (data) =>
  getAction("/common/enum/getAllDictType", data); // 获取所有枚举值类型
export const getDictItemsByTypes = (data) =>
  getAction("/common/enum/getDictItemsByType", data); // 对应模块的枚举值
export const genEntityCode = (data) =>
  getAction("/sys/common/genEntityCode", data); // 根据参数生成对应编号
export const getBathRelProductDate = (data) =>
  getAction("/wmsgoodsbatch/getBathRelProductDate", data); // 根据物品id，批号获取生产日期
export const getLatticeNotification = (data) =>
  getAction("/wmslattice/getLatticeNotification", data); // 收货-上架-入库单-库位选择分页弹窗

export const getWarehouseList = (params) =>
  getAction("/baseSetting/warehouse/enableList", params); // 仓库
export const getWarehouseAreaList = (params) =>
  getAction("/baseSetting/warehouseArea/getEnableListByWarehouse", params); // 库区
export const getWarehouseLatticeDetail = (params) =>
  getAction(`/baseSetting/warehouseLattice/${params}`); // 库位详情
/* ------------------入库模块共有接口 end------------------ */

/* ------------------入库任务 begin------------------ */
export const inboundTaskAdd = (data) =>
  postAction("/inbound/inboundTask/add", data); // 新建入库任务
export const inboundTaskdelete = (params) =>
  deleteAction("/inbound/inboundTask/deleteByTaskId", params); // 删除入库任务
export const inboundTaskEdit = (params) =>
  postAction("/inbound/inboundTask/update", params); // 编辑入库任务
export const inboundTaskDetail = (data) =>
  getAction("/inbound/inboundTask/queryByTaskId", data); // 入库任务详情 - 基本信息、单据信息
export const inboundTaskDetailGoodsList = (data) =>
  getAction("/inbound/inboundTask/infoListByGoods", data); // 入库任务详情 - 物品明细
export const receiptInfoListByGoods = (data) =>
  getAction("/inbound/inboundTask/receiptInfoListByGoods", data); // 入库任务 收货详情
export const receipted = (data) =>
  postAction("/inbound/inboundTask/receipted", data); // 入库任务 收货
/* ------------------入库任务 end-  ----------------- */

/* ------------------入库单 begin------------------ */
export const queryInWholeForPageList = (data) =>
  getAction("inOutDocument/wmsWarehouseOperate/queryInWholeForPage", data); // 上架任务list

export const addInWarehousing = (data) =>
  postAction("/inOutDocument/wmsWarehouseOperate/addInWarehousing", data); // 新建入库单
export const deleteInWareHousing = (params) =>
  deleteAction(
    "/inOutDocument/wmsWarehouseOperate/deleteInWareHousing",
    params
  ); // 删除入库单
export const editInWareHousing = (params) =>
  postAction("/inOutDocument/wmsWarehouseOperate/editInWareHousing", params); // 编辑入库单

export const queryBasicInfoById = (data) =>
  getAction("/inOutDocument/wmsWarehouseOperate/queryBasicInfoById", data); // 入库任务详情 - 基本信息、单据信息
export const queryInGoodsInfoPage = (data) =>
  getAction("/inOutDocument/wmsWarehouseOperate/queryInGoodsInfoPage", data); // 入库任务详情 - 物品明细

/* ------------------入库单 end-  ----------------- */

/* ------------------上架任务 begin------------------ */
export const queryTaskPageList = (data) =>
  getAction("inbound/shelvesTask/queryTaskPageList", data); // 上架任务list
export const deleteShelvesTask = (params) =>
  deleteAction("/inbound/shelvesTask/deleteById", params); // 删除上架任务

export const shelvesTaskDetailAno = (data) =>
  getAction("/inbound/shelvesTask/findById", data); // 上架任务详情 - 基本信息
export const shelvesTaskDetail = (data) =>
  getAction("/inbound/shelvesTask/shelvedInfoListByGoods", data); // 上架任务详情 - 基本信息、 物品明细
export const shelvedGoods = (data) =>
  postAction("/inbound/shelvesTask/shelved", data); // 确认上架
export const queryDefaultLattice = (data) => getAction("/inOutDocument/wmsWarehouseOperate/queryDefaultLattice", data); // 根据物品id获取默认库位

/* ------------------上架任务 end-  ----------------- */

/* ------------------盘点单 begin------------------ */
export const addItask = (data) => postAction("/itask/add", data); // 新建盘点单
export const deleteItask = (params) => deleteAction("/itask/delete", params); // 删除盘点单
export const profitLossOperation = (data) =>
  postAction("/itask/profitLossOperation", data); // 盈亏操作
export const revokedProfitLoss = (data) =>
  postAction("/itask/revokedProfitLoss", data); // 撤销盈亏
export const itaskDetail = (params) => getAction("/itask/queryById", params); // 盘点单详情
export const inventoryItask = (data) => postAction("/itask/inventory", data); // 盘点
export const getBatchCodeByGoodsId = (data) =>
  getAction("/wmsgoodsnotification/getBatchCodeByGoodsId", data); // 根据goodsId查询下属批号
/* ------------------盘点单 end-  ----------------- */

/* ------------------盘盈单、盘亏单 begin------------------ */
export const recordArchive = (params) =>
  fromDataPutAction("/archive/recordArchive", params); // 归档
export const getProfitOrLossDetail = (params) =>
  getAction("/wmsProfitOrLoss/queryBasicInfoById", params); // 盘盈单、盘亏单 详情
export const getProfitOrLossList = (params) =>
  getAction("/wmsProfitOrLoss/queryRelGoodsInfoById", params); // 盘盈单、盘亏单 详情 关联物品list
export const addWmsProOrLoss = (data) =>
  postAction("/wmsProfitOrLoss/addWmsProOrLoss", data); // 新建盘盈单、盘亏单
export const deleteWmsProOrLoss = (params) =>
  deleteAction("/wmsProfitOrLoss/deleteWmsProOrLoss", params); // 删除盘盈单、盘亏单
/* ------------------盘点单、盘亏单 end-  ----------------- */
export const getLatticeNotificationProLoss = (params) =>
  getAction("/wmslattice/getLatticeNotificationProLoss", params); // 盘盈单、盘亏单 详情
